package com.hsped.exception_;

/**
 * @author 王先锋
 * @version 1.0
 */
public class Thead02 {
    public static void main(String[] args) {
        Dog dog=new Dog();
        //创建Thead对象,把dog对象（实现Runnable）,放入Thread
        Thread thread=new Thread(dog);
       // dog.run();
        thread.start();
    }
}

class Dog implements Runnable{//通过实现Runnable接口,开发线程
    int count=0;
    @Override
    public void run() {
        while(true){
            System.out.println("wang"+(++count)+ Thread.currentThread().getName());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(count==10)
                break;
        }
    }
}